<!-- 最高销量月度统计 -->
<div class="col-sm-6 sort-item" rel="{$id}" style="padding:0px;">
	<div class="dash-border" >
		<div class="dash-title">
			<img src="__PUBLIC__/img/chart.png" style="padding-left:15px;padding-right:15px;"/>&nbsp;&nbsp;{$title}&nbsp;
			<small>
				<a rel="{$id}" class="update" href="javascript:void(0)" id="update_widget"><i class="icon-pencil"></i></a> &nbsp;
				<a rel="{$id}" class="delete_zuigao" style="cursor:pointer"><i class="icon-remove"></i></a> &nbsp; 
			</small>
			<!-- <a href="{:U('product/analytics')}" class="dash-swtich">切换到销售统计 >></a> -->
		</div>
		<div class="content-chart" id="amount_monthly_{$id}">
			<div class="ibox-content">
                <div class="spiner-example" style="padding-top: 0px;">
                    <div class="sk-spinner sk-spinner-three-bounce">
                        <div class="sk-bounce1"></div>
                        <div class="sk-bounce2"></div>
                        <div class="sk-bounce3"></div>
                    </div>
                </div>
            </div>
		</div>
	</div>
</div>
<script type="text/javascript">
	$('.delete_zuigao').click(function(){
		var id = $(this).attr('rel');
		swal({
			title: "",
			text: "确定要删除吗？",
			type: "warning",
			showCancelButton: true,
			closeOnConfirm: false
		},
		function(){
			window.location.href = "index.php?m=index&a=widget_delete&id="+id;
		});
	});
$(function () {
	var chart{$id} = new Highcharts.Chart({
		chart: {
			renderTo: 'amount_monthly_{$id}',
			type: 'column'
		},
		title:false,
		subtitle:false,
		 xAxis: {
			categories: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
		},
		yAxis: {
			min: 0,
			title:false
		},
		 tooltip: {
			headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
			pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
				'<td style="padding:0"><b>{point.y} 个</b></td></tr>',
			footerFormat: '</table>',
			shared: true,
			useHTML: true
		},
		plotOptions: {
			column: {
				pointPadding: 0.2,
				borderWidth: 0
			}
		},
		legend: {
			enabled: false
		},
		series: [{
			name: '销量',
			data:[]
		}],
		credits: {  
			enabled: false  
		} 
	});
	//使用JQuery从后台获取JSON格式的数据赋值到图表
	$.ajax({
		type: "get",
		url: "{:U('product/getMonthlyAmount', 'id='.$id)}",    
		dataType: "json",
		success : function(result){
			chart{$id}.series[0].setData(result.data);
			chart{$id}.hideLoading();
			chart{$id}.redraw();
		}
	});
});
</script>
<!-- 最高销量月度统计 END-->